package lib

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"go-micro/framework/gin_"
	"go-micro/src/Boot"
)

func Check_Middleware() gin_.Middleware {
	return func(next gin_.Endpoint) gin_.Endpoint {
		return func(context *gin.Context, request interface{}) (response interface{}, err error) {
			if Boot.ServerIsReady() {
				return next(context, request)
			}
			return nil, fmt.Errorf("server is loading...")
		}
	}
}
